@echo off
setlocal

echo ###################################################################
echo Time at start: 
time < nul
echo.

set MSBUILD="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msbuild.exe"
set NDOC_CONSOLE="d:\Program Files\NDoc 1.3\bin\net\1.1\NDocConsole.exe"
REM
set RELEASE_DIR=..\Release\
set SOLUTION_FILE=Telnet.sln
set NDOC_PROJECT_FILE=TelnetLib.ndoc

echo ###################################################################
%MSBUILD% %SOLUTION_FILE% /p:Configuration=Debug /t:Clean
%MSBUILD% %SOLUTION_FILE% /p:Configuration=Debug
REM
%MSBUILD% %SOLUTION_FILE% /p:Configuration=Release /t:Clean
%MSBUILD% %SOLUTION_FILE% /p:Configuration=Release
REM
%MSBUILD% %SOLUTION_FILE% /p:Configuration=CodeAnalysis /t:Clean
%MSBUILD% %SOLUTION_FILE% /p:Configuration=CodeAnalysis

echo ###################################################################
call makeFxCop.cmd

echo ###################################################################
%NDOC_CONSOLE% -project=%NDOC_PROJECT_FILE%

echo ###################################################################
echo Release (clean)
rmdir /s /q %RELEASE_DIR%
mkdir %RELEASE_DIR%

echo Release (copying)
copy Telnet\bin\Release\TelnetLib.dll %RELEASE_DIR%
copy Telnet\bin\Release\TelnetLib.XML %RELEASE_DIR%
copy Readme.txt %RELEASE_DIR%
copy "Programmers Guide.txt" %RELEASE_DIR%
copy ..\license.txt %RELEASE_DIR%
copy doc\TelnetLib.chm %RELEASE_DIR%
mkdir %RELEASE_DIR%\Samples\
copy Telnet\bin\Release\TelnetLib.dll %RELEASE_DIR%\Samples
copy TelnetConsole\bin\Release\TelnetConsole.exe %RELEASE_DIR%\Samples
copy Winform1\bin\Release\Winform1.exe %RELEASE_DIR%\Samples
mkdir %RELEASE_DIR%\Samples\TelnetConsole\
mkdir %RELEASE_DIR%\Samples\TelnetConsole\Properties\
copy TelnetConsole\Expect.cs %RELEASE_DIR%\Samples\TelnetConsole\
copy TelnetConsole\Program.cs %RELEASE_DIR%\Samples\TelnetConsole\
copy TelnetConsole\TelnetConsoleU.csproj.tmpl %RELEASE_DIR%\Samples\TelnetConsole\TelnetConsole.csproj
copy TelnetConsole\Properties\AssemblyInfo.cs %RELEASE_DIR%\Samples\TelnetConsole\Properties\

echo ###################################################################
goto end
:failed
Echo.
Echo Build failed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Echo.
:end
echo Time at end: 
time < nul
echo.
echo ###################################################################
REM EoF
